"""
响应相关常量模块
定义API响应相关的状态码和消息常量
"""


class ResponseCode:
    """
    API响应状态码常量
    """
    # 成功响应码
    SUCCESS = 200
    
    # 客户端错误响应码
    BAD_REQUEST = 400  # 请求参数错误
    UNAUTHORIZED = 401  # 未授权
    FORBIDDEN = 403  # 禁止访问
    NOT_FOUND = 404  # 资源不存在
    METHOD_NOT_ALLOWED = 405  # 方法不允许
    REQUEST_TIMEOUT = 408  # 请求超时
    CONFLICT = 409  # 资源冲突
    GONE = 410  # 资源不可用
    UNPROCESSABLE_ENTITY = 422  # 请求参数校验失败
    TOO_MANY_REQUESTS = 429  # 请求频率过高
    
    # 服务端错误响应码
    SERVER_ERROR = 500  # 服务器错误
    BAD_GATEWAY = 502  # 网关错误
    SERVICE_UNAVAILABLE = 503  # 服务不可用
    GATEWAY_TIMEOUT = 504  # 网关超时
    
    # 业务自定义状态码
    INVALID_LOGIN = 1001  # 登录失败
    ACCOUNT_LOCKED = 1002  # 账号被锁定
    ACCOUNT_DISABLED = 1003  # 账号被禁用
    TOKEN_EXPIRED = 1004  # 令牌过期
    TOKEN_INVALID = 1005  # 无效令牌
    PERMISSION_DENIED = 1006  # 权限不足
    CAPTCHA_ERROR = 1007  # 验证码错误
    USER_EXIST = 1008  # 用户已存在
    PASSWORD_EXPIRED = 1009  # 密码已过期
    PASSWORD_WEAK = 1010  # 密码强度不足


class ResponseMessage:
    """
    API响应消息常量
    """
    # 通用消息
    SUCCESS = "操作成功"
    FAILED = "操作失败"
    CREATED = "创建成功"
    UPDATED = "更新成功"
    DELETED = "删除成功"
    
    # 错误消息
    BAD_REQUEST = "请求参数错误"
    UNAUTHORIZED = "未授权，请先登录"
    FORBIDDEN = "权限不足，禁止访问"
    NOT_FOUND = "请求的资源不存在"
    METHOD_NOT_ALLOWED = "不支持的请求方法"
    REQUEST_TIMEOUT = "请求超时"
    CONFLICT = "资源冲突或已存在"
    GONE = "请求的资源不可用"
    UNPROCESSABLE_ENTITY = "请求参数校验失败"
    TOO_MANY_REQUESTS = "请求频率过高，请稍后重试"
    SERVER_ERROR = "服务器内部错误"
    BAD_GATEWAY = "网关错误"
    SERVICE_UNAVAILABLE = "服务暂不可用"
    GATEWAY_TIMEOUT = "网关超时"
    
    # 认证相关消息
    INVALID_LOGIN = "用户名或密码错误"
    ACCOUNT_LOCKED = "账号已被锁定，请稍后再试"
    ACCOUNT_DISABLED = "账号已被禁用，请联系管理员"
    TOKEN_EXPIRED = "登录已过期，请重新登录"
    TOKEN_INVALID = "无效的认证令牌"
    PERMISSION_DENIED = "权限不足，无法执行该操作"
    CAPTCHA_ERROR = "验证码错误或已过期"
    USER_EXIST = "用户已存在"
    PASSWORD_EXPIRED = "密码已过期，请修改密码"
    PASSWORD_WEAK = "密码强度不足，请使用更复杂的密码"
